﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Chromos.AIEngine;
using Chromos.ActionEngine;

namespace Chromos.Actors
{
	public abstract class Projectile : Actor
	{
		bool finished = false;
        /// <summary>
        /// Percentage of velocity at which we can apply directional correction
        /// </summary>
        float seekPercentage;
		List<Actor> targets;
		public Actor firingActor;
		public int power;
		public Projectile(Game1 game, Vector2 position, Vector2 velocity, ContentManager content, bool isStatic, Actor firingActor, float seekPercentage, List<Actor> targets)
			: base(game, position, velocity, content, isStatic)
		{
			this.targets = targets;
			this.firingActor = firingActor;
			this.seekPercentage = seekPercentage;
			initProjectileFields();
		}

		public override Projectile createProjectiles(int i)
		{
			return null;
		}

		protected override void initAIEngine()
		{
            aiEngine = new ProjectileAIEngine(this, "normal", 15, false, 0);
		}

		/// <summary>
		/// Inits all projectile properties like power, etc that were not passed in on creation
		/// </summary>
		protected abstract void initProjectileFields();

		public void setFinished(bool b)
		{
			finished = b;
		}
		public bool isFinished()
		{
			return finished;
		}

		public void wallCollide(){
			finished = true;
		}

		public override void collidedProjectile(Projectile p)
		{
			// Do nothing. 
		}
	}
}
